package cn.dengta.webapp.im.form.query;

import cn.dengta.context.model.Language;
import cn.dengta.webapp.base.form.BaseForm;
import cn.dengta.webapp.im.entity.FateRadar;
import cn.dengta.webapp.im.entity.FateRadar.RadarType;
import cn.dengta.webapp.im.entity.FateRadar.Type;
import cn.dengta.webapp.user.entity.User;
import cn.dengta.webapp.user.model.Gender;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.X;

/**
 * 缘分雷达
 */
@Setter
@Getter
public class FateRadarQuery extends BaseForm<FateRadar> {

	/** 用户ID */
	public Long userId;
	/** 雷达类型 */
	public Type type;
	/** 性别 */
	public Gender userGender;
	/** 语言 */
	public Language language;
	/** 性别 */
	public String userNickname;
	/** 过滤用户 */
	public Long[] filterUserIds;
	public RadarType radarType;
	/** 分页数 */
	public Long size;
	/** 分页偏移 */
	public Long offset;
	@Setter(AccessLevel.NONE)
	private User user;

	public void setUserGender(Gender userGender) {
		this.userGender = userGender;
		user().setGender(userGender);
	}

	public void setUserId(Long userId) {
		this.userId = userId;
		user().setId(userId);
	}

	public void setUserNickname(String userNickname) {
		this.userNickname = userNickname;
		user().setNickname(userNickname);
	}

	public User user() {
		return user = X.getElse(user, User::new);
	}

	public void setType(Integer type) {
		this.type = Type.of(type);
	}

}
